import request from '../utils/request'

// 获取用户所有地址
export function getAddressList() {
  return request({
    url: '/address/getAll',
    method: 'get'
  })
}

// 添加地址
export function addAddress(data) {
  return request({
    url: '/address/add',
    method: 'post',
    params: data
  })
}

// 更新地址
export function updateAddress(data) {
  return request({
    url: '/address/update',
    method: 'post',
    params: data
  })
}

// 删除地址
export function deleteAddress(id) {
  return request({
    url: `/address/delete/${id}`,
    method: 'post'
  })
}

// 设置默认地址
export function setDefaultAddress(id) {
  return request({
    url: `/address/setDefault/${id}`,
    method: 'post'
  })
}

// 获取默认地址
export function getDefaultAddress() {
  return request({
    url: '/address/getDefault',
    method: 'get'
  })
}